class_name AttributeBasedMagnitudeCalculation
extends GameplayModifierMagnitudeCalculation

## 进行运算的属性值的来源
enum AttributeSourceType {
	Source,
	Target,
}

##
@export var attribute_name: String

##
@export var attribute_source_type: AttributeSourceType

##
@export var k: float = 1.0

##
@export var b: float = 0.0


## attribute_current_value * k + b
func _calculate(source: AbilitySystemComponent, target: AbilitySystemComponent) -> float:
	var selected := source if attribute_source_type == AttributeSourceType.Source else target
	var attribute = selected.attribute_set.get_attribute(attribute_name)
	return attribute.current_value * k + b
